UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hdZo6sLTUQwZnGII/yOyl00Vbf4r79vpAiS134Bf3ME='
WHERE
key_id = 'b02cd8d900eaea7677625e6598434f8d94edae29e7c0100b929cd346f8ccc1d8'
AND (
token = 'hdZo6sLTUQwZnGII/yOyl00Vbf4r79vpAiS134Bf3ME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)