UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3JG1P1wsjZEzXAPDplEyBwR71NFf7x9+R3MOwSHNFWM='
WHERE
key_id = 'e0470ccc8f5c5a044010e19cbcafa304ebfa1f0a72de0b659721f9d9feee20a5'
AND (
token = '3JG1P1wsjZEzXAPDplEyBwR71NFf7x9+R3MOwSHNFWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)