UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nqdHxreMOZX1QpjjMrgavXHw21xiY5vH+hZEGZEYwJ0='
WHERE
key_id = 'd3b4562328209f80e48f0c3e34e0d296257b8212ab9fd917694d4276e34fa2fb'
AND (
token = 'nqdHxreMOZX1QpjjMrgavXHw21xiY5vH+hZEGZEYwJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)