UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lh+Y3tcqvc1krhSLEa7jY9uxHzaLWFZTKARNbBEhrys=' 
WHERE 
  key_id = '3fb76a9c207e375df591a255f369d7f389667f086256280b02ec47eebef2f6a8' 
  AND (
    token = 'lh+Y3tcqvc1krhSLEa7jY9uxHzaLWFZTKARNbBEhrys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022