UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eUAfffKajrILO1uVyBYXlLi01rhr+iL/dhYIYkhRdqU=' 
WHERE 
  key_id = '951ffb8505b6b742c8a2d20155e504bfaa2c0771845d37c57a5a9b8a4d56fba6' 
  AND (
    token = 'eUAfffKajrILO1uVyBYXlLi01rhr+iL/dhYIYkhRdqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025