UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1iXzJvHdXDpdyQDiD0YjULKQJUA73l121mkFkWrBTY=' 
WHERE 
  key_id = '65e82d4006a5098e5099bcb9dd7e42dac2fdcf443ebefa5db96a4793a01420f7' 
  AND (
    token = 'J1iXzJvHdXDpdyQDiD0YjULKQJUA73l121mkFkWrBTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017