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