UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIkpjB0JBCuQh9sZTvsO60IypuSHToiXF0Fxx7QErbQ='
WHERE
key_id = 'de9c9a8883e36220d4a69bf15bdb3803e6cd77d8484ca163b245afa3a36f753a'
AND (
token = 'kIkpjB0JBCuQh9sZTvsO60IypuSHToiXF0Fxx7QErbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)