UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y01ZkaXN5bZIch9YrT0khYN0ZCeek4nQOMARPZ/ofZ8=' 
WHERE 
  key_id = 'b029dffab19245a0187ad8bbdb229843f6d96d6a8850f257136b088af4efa969' 
  AND (
    token = 'y01ZkaXN5bZIch9YrT0khYN0ZCeek4nQOMARPZ/ofZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049