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

Query time 0.00041