UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'an7u8aUV6T5yMcd2KHCuR6ZnMZiW8AWEmTHIpwd5hD4=' 
WHERE 
  key_id = 'da680acc89237f259634224b81e2846404074e305b342ac4e23079abecb2f613' 
  AND (
    token = 'an7u8aUV6T5yMcd2KHCuR6ZnMZiW8AWEmTHIpwd5hD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022