UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pr1iFqBZY8V04ohItSAGC2VGeEtvhw1+XJUW9KMnOqs='
WHERE
key_id = 'da7aa699810f1d136b0eed0214c84b3a1338921a895a1a3081c85006b57b8170'
AND (
token = 'Pr1iFqBZY8V04ohItSAGC2VGeEtvhw1+XJUW9KMnOqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)