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