UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRPrxwKVKx9UpRSB5AsehoiVSK4MlD83Opzwqjdxw0Y=' 
WHERE 
  key_id = '9511a4a78c071de97a049b567541a01225299b24369ef8beed60702948b78271' 
  AND (
    token = 'JRPrxwKVKx9UpRSB5AsehoiVSK4MlD83Opzwqjdxw0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040