UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm29pgt3vAPqbfdZdSdyOQJRcI1F3IjxEmE46XDkyORw='
WHERE
key_id = '85164750592e4fe725ba5ca73b369edbb054e600740f17509c5cecba13c18b2d'
AND (
token = 'm29pgt3vAPqbfdZdSdyOQJRcI1F3IjxEmE46XDkyORw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)