UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5fJNUWHm+jlbmsX9OX+b0tikkvfrZY+BG/I+vh7Zqo=' 
WHERE 
  key_id = 'cd0bdc04e81c25acd34819f809f2ae62448040702f3e0e0bf35d761feeb29b9d' 
  AND (
    token = 'N5fJNUWHm+jlbmsX9OX+b0tikkvfrZY+BG/I+vh7Zqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034