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