UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pz9IAT1V03yseCeDDEKLttFOq7Ii4JifHQSXUJA+Hww='
WHERE
key_id = '7204f3ffba66445e1fa008fc6bde9c145b07ad1d10543f00de8a45893b290529'
AND (
token = 'pz9IAT1V03yseCeDDEKLttFOq7Ii4JifHQSXUJA+Hww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)