UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'am+k+cAuWi134QLCUwuGtXe5kt/npGx0YyNmqlp19UY=' 
WHERE 
  key_id = '3fa357367e7d1ac3afb229a43efacbdbbc52e8bbc246eb345761d5e5dfef63ed' 
  AND (
    token = 'am+k+cAuWi134QLCUwuGtXe5kt/npGx0YyNmqlp19UY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032