UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wmFdY4uHE2aVs/4CH4t1Miw+3mi1rkZpv4L3omt1HRg='
WHERE
key_id = '228c508a5ee4a372aeb20bcaadb67d17cefc84088d9d854ade07dcfc1e975bc2'
AND (
token = 'wmFdY4uHE2aVs/4CH4t1Miw+3mi1rkZpv4L3omt1HRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)