UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ny0S4mqqk5d8lQtvPBs0WQn4NYSghF+5xHdW4yEcxyQ='
WHERE
key_id = 'b5173b9c4cdb7d2e8dff9cd4b43514c3b5d334d9dc5812e85f20aec4cab8ffac'
AND (
token = 'Ny0S4mqqk5d8lQtvPBs0WQn4NYSghF+5xHdW4yEcxyQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)