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