UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IwvZxU0cb1ggPo4MWOU7mZpjo9z6uo1v+2/8Wv8G3HM=' 
WHERE 
  key_id = '3cdb1f16151f8d0272a87524ca8442937440d1ae82bf3bf45f6a869cc6f71eb2' 
  AND (
    token = 'IwvZxU0cb1ggPo4MWOU7mZpjo9z6uo1v+2/8Wv8G3HM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040