UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hcs9hecZGeqJst6r9rAFFNxO/U9MeUezYe81eUQUX0Q='
WHERE
key_id = '7096c6e9dec811dfee13df648aff3802a4230a4d31e835f8c4148e45f3d6c20a'
AND (
token = 'Hcs9hecZGeqJst6r9rAFFNxO/U9MeUezYe81eUQUX0Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)