UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bRA76Ghay4mlrAlhTeKwgalMZdlwFXnOUpVRt3q36l4='
WHERE
key_id = '23c27eb0d312a644441fd3773147437d955b84d383b4db161d8d92eb37f1404d'
AND (
token = 'bRA76Ghay4mlrAlhTeKwgalMZdlwFXnOUpVRt3q36l4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)