UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O7kw9fp0tIvA+n8gG4mpcxnyuEpDs7WZS1GG6tUbYww='
WHERE
key_id = '082ff565b47e3d65362ecc9aa59396a90793d178822cdf3c1e3ba22d222d7d5e'
AND (
token = 'O7kw9fp0tIvA+n8gG4mpcxnyuEpDs7WZS1GG6tUbYww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)