UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iXXYU9qDHjiTSrpi9VyXHzTcGA8quVzKT8gthoQxekY='
WHERE
key_id = '813a9dda350dce41afcdc5c1d591a0851e6da368f9bc5a8370d54935f4b7a204'
AND (
token = 'iXXYU9qDHjiTSrpi9VyXHzTcGA8quVzKT8gthoQxekY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)