UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O8Ge4yPe57QLr5zTptowQXE2ofZv0X+h5iPd8+ndJVA='
WHERE
key_id = '0436d01116df12b31c1a61a3df079479b0679fc08a544442348a42e35889bd80'
AND (
token = 'O8Ge4yPe57QLr5zTptowQXE2ofZv0X+h5iPd8+ndJVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)