UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fGUSh48R0nhc5TKXWQUW4JWjBfNrKVh8MhSyX0LPQN8=' 
WHERE 
  key_id = '773b78aed4f03041a2ce2036ee23b052cdd0b760cd0698e28217c1bf38208bde' 
  AND (
    token = 'fGUSh48R0nhc5TKXWQUW4JWjBfNrKVh8MhSyX0LPQN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049