UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ycjaaWWpLxvTbFm3b9z6fwSvy/8k8ncJA0LBzNGZ0E4='
WHERE
key_id = 'c4739ab463f94880d120c3a4c11718f8847fbd99484f264be14cc335fde2414a'
AND (
token = 'ycjaaWWpLxvTbFm3b9z6fwSvy/8k8ncJA0LBzNGZ0E4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)