UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 300, 
  token = 'Iz1HZi4LKGX9Si0hhOk2d6Xb+Oc98EwDvbigqeziaCc=' 
WHERE 
  key_id = '07ab38fdd9d9c977489d7989c8a22b230feb381305b10523ca2f82f4c9a035c0' 
  AND (
    token = 'Iz1HZi4LKGX9Si0hhOk2d6Xb+Oc98EwDvbigqeziaCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038