UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7raiaXZNaoeWCHxd3sH5RsnT+H2Ep7lNA22H7ttklE='
WHERE
key_id = '9175d777060d322132caec0d31cde60a6d240c59d2ba87c0c1a8a46c0727ddd5'
AND (
token = 'k7raiaXZNaoeWCHxd3sH5RsnT+H2Ep7lNA22H7ttklE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)