UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZihcpZtidiMwMajkNkw45s6SSvzeO90pDiJuGgVhncY='
WHERE
key_id = '9ee2090d9c02bfae2d783c814b5e8b89ad0166aac729a7af2d27150bf21c5c5a'
AND (
token = 'ZihcpZtidiMwMajkNkw45s6SSvzeO90pDiJuGgVhncY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)