UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ABrw7tvMg6wDmiRhMnFrk8hazUnDlcsMU8CUNo9V7bU='
WHERE
key_id = 'feeaf47137c7325422083ad7e10ace4973e54a1252e4c5627a6796b19465bf50'
AND (
token = 'ABrw7tvMg6wDmiRhMnFrk8hazUnDlcsMU8CUNo9V7bU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)