UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1JeyAX9VVqA7dypBDqfPQkhSjxQBscgw2Br3OVGFWI=' 
WHERE 
  key_id = '2cfcce7ed27815701db2e511420e6800cdd16431bed416f03b835c6cd63b972c' 
  AND (
    token = 'J1JeyAX9VVqA7dypBDqfPQkhSjxQBscgw2Br3OVGFWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039