UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'isA5e/459hXRYNeac3ZCSMe6CSkiDoffbUL8/5EYzDw='
WHERE
key_id = 'ce8f7f0e346c33460600b1c32129c536a6c535b42edbb683c4c684ae3802c71d'
AND (
token = 'isA5e/459hXRYNeac3ZCSMe6CSkiDoffbUL8/5EYzDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)