UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o+WDD1N3Kb5++hXzxev7WhhS6gQKUdBfMXH95z81euU='
WHERE
key_id = 'a4ca7d712f647c1ed6dd9cb6cec672a87d69c272d81cb78474deb6545efdd78f'
AND (
token = 'o+WDD1N3Kb5++hXzxev7WhhS6gQKUdBfMXH95z81euU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)