UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kcPt95oJHqONheXVM8jsM5iBdcJIUc0m3rfPU+O3H74='
WHERE
key_id = 'bb217287fa3397af4ad73bccbf9af11dafa71e721d5a0b43d315c3257a3b53cc'
AND (
token = 'kcPt95oJHqONheXVM8jsM5iBdcJIUc0m3rfPU+O3H74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)