UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VrPM20co+4WmqRLmub6KeH0Pl9oa2jYEvbnHQpk/uNc=' 
WHERE 
  key_id = '97c76465d5e7290363595d793ccf8603bcfc6db624ba3044c7d10078da3b6911' 
  AND (
    token = 'VrPM20co+4WmqRLmub6KeH0Pl9oa2jYEvbnHQpk/uNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028