UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OlPC7+4h1SU/T28KYwwQNjrzUlPTsgED8DiGHA5ucbE='
WHERE
key_id = 'b97f62381a238ffc056e6cda3a5f9a2e983859e0049833e5af983ea9589352c9'
AND (
token = 'OlPC7+4h1SU/T28KYwwQNjrzUlPTsgED8DiGHA5ucbE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)