UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wim6q5IyqoMg03wuERAyQaNVjTSWdkcM3DeeOLCSyCE=' 
WHERE 
  key_id = '7f578bf4c6ec1cf33e5f4aad522bd64543bb5d66e5feca7c7cecd74880595323' 
  AND (
    token = 'Wim6q5IyqoMg03wuERAyQaNVjTSWdkcM3DeeOLCSyCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030