UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r2E2xZL5QuiP47qMbik/xbp9vN8hnswQQk+BrXdFuXY='
WHERE
key_id = 'f6c9a01f8bcc3034f7033d2bd1c3e7680a18f598c8baa43bb12f063637290482'
AND (
token = 'r2E2xZL5QuiP47qMbik/xbp9vN8hnswQQk+BrXdFuXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)