UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D1RP82nR1GDhPqs3hJX5+bpSmRhZIRbFeIpGbs35p2U='
WHERE
key_id = '3e51845a388058df61986e482c0578966ab0d26a173cd9a390dd47d9d31946e7'
AND (
token = 'D1RP82nR1GDhPqs3hJX5+bpSmRhZIRbFeIpGbs35p2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)