UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BYrsvDWbtery7cLmJWzoT2rcq+o6hWJVeRw4wpf5sw0='
WHERE
key_id = 'd20cffd7e7d1eef4210fe851ed54fda713839e823e15d10697a0d5d31f09bb2f'
AND (
token = 'BYrsvDWbtery7cLmJWzoT2rcq+o6hWJVeRw4wpf5sw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)