UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sy9K2dE3fuIazfw0ftYdKbqwsEsvgI3Z3Oxl8R+3JaQ=' 
WHERE 
  key_id = '639e874d4fa586f1f1744de058e8d94afe628586e7e712209854f1b071b9e1b2' 
  AND (
    token = 'Sy9K2dE3fuIazfw0ftYdKbqwsEsvgI3Z3Oxl8R+3JaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025