UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aIj5bpQnj+Kiuyb5sBpvIJ13TzZm8aK/t5dfX95YuIo='
WHERE
key_id = '4a89e4bd7fc2b6e1c98f5b854f73cc46b6a7d4bf3b2b8aaac311d04642c66b0a'
AND (
token = 'aIj5bpQnj+Kiuyb5sBpvIJ13TzZm8aK/t5dfX95YuIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)