UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lAst4h3bOMutRr9jmAqOB+WlKdjp6+9EVODwO+R/EYA=' 
WHERE 
  key_id = '3cc4f61f3dc6ff70a4cdd88738a3108e50a9976dce854f7f4284936197c028da' 
  AND (
    token = 'lAst4h3bOMutRr9jmAqOB+WlKdjp6+9EVODwO+R/EYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047