UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kAzfj0udV4pjC2olW3rl5TzA7Qbt8zbLJM6Qzb7GdVg='
WHERE
key_id = 'd3ee085e24129d09f940363050157ee1c4b73e88b10b2f3bf34192848b0bd4a1'
AND (
token = 'kAzfj0udV4pjC2olW3rl5TzA7Qbt8zbLJM6Qzb7GdVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)